/**
 * Created by guoguanrong on 2019/3/19.
 */
const path = require("path")
const webpack = require("webpack")
const projectName = require("./project")
const manifest = require("../vendor-manifest.json")

const config = {
  base: {
    pages: {
      index: {
        entry: "src/main.js",
        template: "public/index.html",
        filename: "index.html",
      },
    },
    resolve: {
      alias: {
        "@": path.resolve("src/"),
      },
    },
    plugins: [
      // 关联dll拆分出去的依赖
      new webpack.DllReferencePlugin({
        manifest,
      }),
    ],
  },
  //活动1
  projectA: {
    pages: {
      index: {
        entry: "src/projects/projectA/main.js",
        template: "public/index.html",
        filename: "index.html",
      },
    },
    configureWebpack: {
      resolve: {
        alias: {
          "~": path.resolve("src/projects/projectA/"),
          "@": path.resolve("src/"),
        },
      },
    },
  },
  //活动2
  projectB: {
    pages: {
      index: {
        entry: "src/projects/projectB/main.js",
        template: "public/index.html",
        filename: "index.html",
      },
    },
    configureWebpack: {
      resolve: {
        alias: {
          "~": path.resolve("src/projects/projectB/"),
          "@": path.resolve("src/"),
        },
      },
    },
  },
}

const configObj = config[projectName.name]
module.exports = configObj
